#include "addgroupnotice.h"
#include "ui_addgroupnotice.h"
#include "publicstruct.h"
#include "mytcpsocket.h"

AddGroupNotice::AddGroupNotice(int _gid,QWidget *parent) :
    QWidget(parent),
    ui(new Ui::AddGroupNotice)
{
    ui->setupUi(this);

    gid = _gid;

    this->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);

    this->setWindowTitle("发布群公告");

    // qss渲染
    setQssStyle(QString("../style/AddGroupNotice.qss"),this);

}

AddGroupNotice::~AddGroupNotice()
{
    delete ui;
}

void AddGroupNotice::on_btn_release_clicked()
{
    // 获取群公告内容
    QString info = ui->textEdit->toPlainText();

    // 发送群公报报文
    QVariantMap map;
    map["cmd"] = "release_group_notice";
    map["uid"] = GlobalObject::getGlobalObject()->getUserInfo().sdata.dd_num;
    map["gid"] = gid;
    map["content"] = info;

    GlobalObject::getGlobalObject()->sendRequest(map);

    this->close();

}

